/*
This file is part of vlc-remote.

vlc-remote is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

vlc-remote is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with vlc-remote.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1

Item {
    id:root
    width: parent.width
    height: 56
    x: 2
    anchors.margins: 2

    property alias title : title.text
    property alias subTitle:subTitle.text
    property bool isCurrent: false

    property string iconType: "directory"
    onIconTypeChanged: {
        switch (iconType) {
        case "dir":
            icon.source = "file:///usr/share/themes/blanco/meegotouch/icons/icon-m-toolbar-directory-white.png";
            break;
        case "image":
            icon.source = "file:///usr/share/themes/blanco/meegotouch/icons/icon-m-toolbar-gallery-white.png";
            break;
        case "audio":
            icon.source = "file:///usr/share/themes/blanco/meegotouch/icons/icon-m-toolbar-content-audio-white.png";
            break;
        case "video":
            icon.source = "file:///usr/share/themes/blanco/meegotouch/icons/icon-m-content-gallery.svg";
            break;
        case "file":
            icon.source = "file:///usr/share/themes/blanco/meegotouch/icons/icon-s-status-invitation-pending.png";
            break;
        case "vlc":
            icon.source = "../gfx/vlc-256.png";
            break;
        case "favourite":
            icon.source = "file:///usr/share/themes/blanco/meegotouch/icons/icon-m-toolbar-favorite-mark-white.png";
            break;
        case "heart":
            icon.source = "file:///usr/share/themes/blanco/meegotouch/icons/icon-m-toolbar-frequent-used-white.png";
            break;

        }
    }

    signal clicked()
    signal doubleClicked()

    Rectangle {
        id: currentIndicator
        visible: isCurrent
        width: root.width - 4
        height: root.height - 4
        x: 0
        y: 2
        border.color: "#cccccc"
        border.width: 2
        radius: 8
        color: "black"
    }

    Row {
        Column {
            Image {
                id: icon
                sourceSize.width: 48
                sourceSize.height: 48
                width: 48
                height: 48
            }
        }

        Column {

            Text {
                id:title
                width:  root.width - 68
                elide: "ElideRight"
                color: "white"
                font.pixelSize: 24

            }
            Text {
                id:subTitle
                width:  root.width - 68
                elide: "ElideRight"
                color: "#ccc"
                font.pixelSize: 16

            }
        }
        /*Image {
            id:currentImage
            width: 48
            height: 48
            sourceSize.width: 48
            sourceSize.height: 48
            source: "file:///usr/share/themes/blanco/meegotouch/icons/icon-m-toolbar-mediacontrol-play-white.png"
            visible: isCurrent
            x: root.width - 68
            y: 0
            opacity: 0.5
        }*/

    }

    MouseArea {
        id:mouseArea
        anchors.fill: parent
        onClicked:{
            root.clicked()

        }
        onDoubleClicked:{
            root.doubleClicked()

        }
    }
}
